import {createRouter, createWebHashHistory, type RouteRecordRaw} from 'vue-router'
import mobileRouter from '@router/module/mobile/mobile.module'
import computerRouter from '@router/module/computer/computer.module'

const routes = [
    ...mobileRouter,
    ...computerRouter,
    {
        path: '/',
        component: () => import('@/layout/index.vue'),
    },
]
const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    routes: routes
})
router.beforeResolve((to, from, next) => {
    const title = to.meta.title as string | undefined;
    window.document.title = title || '测试项目'
    next()
})

export default {
    router,
    routes
}
